package com.wuh.service.impl;

import com.wuh.mapper.SysActiveMapper;
import com.wuh.model.SysActive;
import com.wuh.service.SysActiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 活动表(SysActive)表服务实现类
 *
 * @author makejava
 * @since 2020-06-15 10:35:40
 */
@Service
public class SysActiveServiceImpl implements SysActiveService {

    @Autowired
    private SysActiveMapper sysActiveMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param activeId 主键
     * @return 实例对象
     */
    @Override
    public SysActive queryById(Integer activeId) {
        return this.sysActiveMapper.queryById(activeId);
    }

    /**
     * 查询所有的活动数据
     * @param sysActive 实例对象
     * @return
     */
    @Override
    public List<SysActive> queryAll(SysActive sysActive) {
        return sysActiveMapper.queryAll(sysActive);
    }


    /**
     * 新增数据
     *
     * @param sysActive 实例对象
     * @return 实例对象
     */
    @Override
    public SysActive addActive(SysActive sysActive) {
        this.sysActiveMapper.addActive(sysActive);
        return sysActive;
    }

    /**
     * 修改数据
     *
     * @param sysActive 实例对象
     * @return 实例对象
     */
    @Override
    public SysActive updateActive(SysActive sysActive) {

        this.sysActiveMapper.updateActive(sysActive);
        return this.queryById(sysActive.getActiveId());
    }

    /**
     * 通过主键删除数据
     *
     * @param activeId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer activeId) {
        return this.sysActiveMapper.deleteById(activeId) > 0;
    }
}